<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>隔行变色</title>
	</head>
	<body>
		<table id="data">
			<tr>
				<td>哈哈哈哈</td>
				<td>哈哈哈哈</td>
				<td>哈哈哈哈</td>
				<td>哈哈哈哈</td>
			</tr>
			<tr>
				<td>哈哈哈哈</td>
				<td>哈哈哈哈</td>
				<td>哈哈哈哈</td>
				<td>哈哈哈哈</td>
			</tr>
			<tr>
				<td>哈哈哈哈</td>
				<td>哈哈哈哈</td>
				<td>哈哈哈哈</td>
				<td>哈哈哈哈</td>
			</tr>
			<tr>
				<td>哈哈哈哈</td>
				<td>哈哈哈哈</td>
				<td>哈哈哈哈</td>
				<td>哈哈哈哈</td>
			</tr>
			<tr>
				<td>哈哈哈哈</td>
				<td>哈哈哈哈</td>
				<td>哈哈哈哈</td>
				<td>哈哈哈哈</td>
			</tr>
			<tr>
				<td>哈哈哈哈</td>
				<td>哈哈哈哈</td>
				<td>哈哈哈哈</td>
				<td>哈哈哈哈</td>
			</tr>
		</table>
		
		<script type="text/javascript" src="../js/jquery-3.6.0.js"></script>
		<script type="text/javascript">
			// $('#data tr:odd').css('background','#ccccff')
			// $('#data tr:odd').addClass('odd')
			$('#data tr:odd').attr('class','odd')
		</script>
	</body>
</html>
